<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"	
	template="/resources/scaffold/pageTemplate.xhtml">

	<f:metadata>
		<f:viewParam name="id" value="#{billsBean.id}"/>
		<f:event type="preRenderView" listener="#{billsBean.retrieve}"/>
	</f:metadata>

	<ui:param name="pageTitle" value="Create Bills"/>

	<ui:define name="header">
		Bills
	</ui:define>

	<ui:define name="subheader">
		<c:choose>
			<c:when test="#{!empty billsBean.id}">
				Edit existing Bills
			</c:when>
			<c:otherwise>
				Create a new Bills
			</c:otherwise>
		</c:choose>
	</ui:define>

	<ui:define name="footer"/>

	<ui:define name="main">
		<h:form id="create">
			<h:messages globalOnly="true" styleClass="error"/>

			<h:panelGrid columnClasses="label,component,required" columns="3">
				<h:outputLabel for="billsBeanBillsBillDate" value="Bill Date:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsBillDate" maxLength="10" required="true" value="#{billsBean.bills.billDate}">
						<f:convertDateTime type="date"/>
					</h:inputText>
					<h:message for="billsBeanBillsBillDate" styleClass="error"/>
				</h:panelGroup>
				<h:outputText value="*"/>
				<h:outputLabel for="billsBeanBillsBillNumber" value="Bill Number:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsBillNumber" required="true" value="#{billsBean.bills.billNumber}"/>
					<h:message for="billsBeanBillsBillNumber" styleClass="error"/>
				</h:panelGroup>
				<h:outputText value="*"/>
				<h:outputLabel for="billsBeanBillsComment" value="Comment:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsComment" value="#{billsBean.bills.comment}"/>
					<h:message for="billsBeanBillsComment" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="billsBeanBillsCreatedOn" value="Created On:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsCreatedOn" maxLength="10" value="#{billsBean.bills.createdOn}">
						<f:convertDateTime type="date"/>
					</h:inputText>
					<h:message for="billsBeanBillsCreatedOn" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="billsBeanBillsModifiedOn" value="Modified On:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsModifiedOn" maxLength="10" value="#{billsBean.bills.modifiedOn}">
						<f:convertDateTime type="date"/>
					</h:inputText>
					<h:message for="billsBeanBillsModifiedOn" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="billsBeanBillsTableId" value="Table Id:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsTableId" required="true" value="#{billsBean.bills.tableId}"/>
					<h:message for="billsBeanBillsTableId" styleClass="error"/>
				</h:panelGroup>
				<h:outputText value="*"/>
				<h:outputLabel for="billsBeanBillsTotalAmount" value="Total Amount:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsTotalAmount" required="true" value="#{billsBean.bills.totalAmount}"/>
					<h:message for="billsBeanBillsTotalAmount" styleClass="error"/>
				</h:panelGroup>
				<h:outputText value="*"/>
				<h:outputLabel for="billsBeanBillsCustomerId" value="Customer Id:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsCustomerId" value="#{billsBean.bills.customerId}"/>
					<h:message for="billsBeanBillsCustomerId" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="billsBeanBillsCreatedBy" value="Created By:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsCreatedBy" value="#{billsBean.bills.createdBy}"/>
					<h:message for="billsBeanBillsCreatedBy" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="billsBeanBillsModifiedBy" value="Modified By:"/>
				<h:panelGroup>
					<h:inputText id="billsBeanBillsModifiedBy" value="#{billsBean.bills.modifiedBy}"/>
					<h:message for="billsBeanBillsModifiedBy" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="billsBeanBillsIsBilled" value="Is Billed:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="billsBeanBillsIsBilled" value="#{billsBean.bills.isBilled}"/>
					<h:message for="billsBeanBillsIsBilled" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="billsBeanBillsIsDeleted" value="Is Deleted:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="billsBeanBillsIsDeleted" value="#{billsBean.bills.isDeleted}"/>
					<h:message for="billsBeanBillsIsDeleted" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="billsBeanBillsIsPublic" value="Is Public:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="billsBeanBillsIsPublic" value="#{billsBean.bills.isPublic}"/>
					<h:message for="billsBeanBillsIsPublic" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
			</h:panelGrid>

			<div class="buttons">
				<h:commandLink value="Save" action="#{billsBean.update}" styleClass="btn btn-primary"/>
				<c:choose>
					<c:when test="#{!empty billsBean.id}">
						<h:link value="Cancel" outcome="view" styleClass="btn btn-primary">
							<f:param name="id" value="#{billsBean.id}"/>
						</h:link>
						<h:commandLink value="Delete" action="#{billsBean.delete}" styleClass="btn btn-primary"/>
					</c:when>
					<c:otherwise>
						<h:link value="Cancel" outcome="search" styleClass="btn btn-primary"/>
					</c:otherwise>
				</c:choose>
			</div>
		</h:form>
	</ui:define>

</ui:composition>